package com.example.treasureadmin.controller;

import com.example.treasureadmin.entity.MsgEntity;
import com.example.treasureadmin.enumerate.CommentType;
import com.example.treasureadmin.model.TrashDataModel;
import com.example.treasureadmin.service.TrashDataService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.PathVariable;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/treasure-admin")
public class TrashDataController {

    @Autowired
    private TrashDataService trashDataService;

    @RequestMapping("/trash/all")
    public MsgEntity getAll(){
        List<TrashDataModel> all = trashDataService.getAll();
        return new MsgEntity("200", "SUCCESS",all);
    }

    @RequestMapping("/trash/{status}")
    public MsgEntity getAll(@PathVariable("status") CommentType status){
        List<TrashDataModel> all = trashDataService.getDataByStatus(status);
        return new MsgEntity("200", "SUCCESS",all);
    }

}
